/**
 * 给定一点和一条直线，求点在直线的垂足。
 * 用射影几何
 */
#include <bits/stdc++.h>
using namespace std;

using Real = double;

struct Point{
    Real x, y;
    Point(Real a=0, Real b=0):x(a),y(b){}
    void input(){
        cin >> x >> y;
    }
    void output()const{
        cout << fixed << setprecision(12) << x << " " << y << endl;
    }
};

struct Line{
    Real a, b, c;
    Line(const Point &p, const Point & q){
        a = p.y - q.y;
        b = q.x - p.x;
        c = p.x * q.y - q.x * p.y;
    }
    Point inter(const Line & r) const {
        auto x = b * r.c - c * r.b;
        auto y = r.a * c - a * r.c;
        auto t = a * r.b - b * r.a;
        assert(t);
        return Point(x / t, y / t);
    }
};

Point P, U, V;
Point Q;

Point proc(){
    Line line(U, V);
    Point T(P.x + line.a, P.y + line.b);
    Line another(P, T);
    Q = line.inter(another);
    return Q;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(0);
    int nofkase; cin >> nofkase;
    for(int kase=1;kase<=nofkase;++kase){
        P.input(); U.input(); V.input();
        proc().output();
    }
    return 0;
}